<template>
	<view class="bg-white">
		<view>
			<view class="padding" v-for="(item,key) in dateYyjl" :key="key">
				<view class="padding-bottom">{{key}}</view>
				<view class="shadow round">
					<view class="padding-sm" v-for="(to,tey) in item" :key="tey">
						<view class="flex">
							<view class="flex-sub">
								<view class="text-gray flex justify-between">
									<view class="text-red">￥{{to.price / 100}}</view>
									<view class="text-gray">
										<text
											class="cuIcon-timefill margin-lr-xs">{{to.st}}</text>
										<text>~</text>
										<text
											class="cuIcon-timefill margin-lr-xs">{{to.et}}</text>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			dateYyjl: {
				type: Object,
				default: function() {
					return {};
				}
			},
		},
		mounted: function() {

		},
		watch: {
			dateYyjl: function(newval, oldval) {
				if (this.dateYyjl) {
					let keys = Object.keys(this.dateYyjl);
					if (keys.length > 0) {
						this.TabCur = keys[0];
					}
				}
				this.yyjls = {};
				this.$emit("datesChange", this.yyjls);
			},
		},
		data() {
			return {
				TabCur: "",
				scrollLeft: 0,
				yyjls: {},
			};
		},
		methods: {
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
			},
			checkTo: function(tey, to) {
				to.checked = !to.checked;
				if (to.checked) {
					this.yyjls[to.cd+tey] = to;
				} else {
					delete this.yyjls[to.cd+tey];
				}
				this.$emit("datesChange", this.yyjls);
			}
		}
	}
</script>

<style scoped>
	.check {
		position: absolute;
		left: 30rpx;
	}
</style>